<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		
		<table width="500px" border="1">
			<tr>
				<td>ID</td>
				<td>姓名</td>
			</tr>
			<tr>
				<td>1</td>
				<td>陈杨森</td>
			</tr>
			<tr>
				<td>2</td>
				<td>关琛</td>
			</tr>
			<tr>
				<td>3</td>
				<td>王超</td>
			</tr>
			<tr>
				<td>4</td>
				<td>杨越</td>
			</tr>
			<tr>
				<td>5</td>
				<td>陈叶</td>
			</tr>
			<tr>
				<td>5</td>
				<td>石睿鑫</td>
			</tr>
		</table>
	</body>
	
	<script type="text/javascript" src="../../js/jquery-1.7.2.js" ></script>
	
	<script>
	
		$(function(){
			
			//1 找到符合条件的td
			var tds = $('table tr td');
			
			//2遍历 找到里面的内容 比较
			tds.each(function(index,data){
				
				//难点： this表示数组tds里面的1个元素<td>杨越</td>  这个元素是js对象
				//2 js对象怎么转换成jQuery  this   ==>  $(this)
				
				//console.log(this);
				console.log(data.innerText);
				if(data.innerText.charAt(0) == '陈'){
					/*$(this).parent().css({
						'background-color':'red',
					});*/
					
					//适合js比较牛的人
					this.style.backgroundColor='red';
				}
			});
			
		});
	</script>
</html>
